package com.isoft.airportsystem.service.impl;

import com.isoft.airportsystem.entity.GTLS.DFLT_GTLS;
import com.isoft.airportsystem.entity.META;
import com.isoft.airportsystem.mapper.GTLSMapper;
import com.isoft.airportsystem.mapper.MetaMapper;
import com.isoft.airportsystem.service.GtlsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class GltsServiceImpl implements GtlsService {
    @Resource
    private GTLSMapper gtlsMapper;

    @Resource
    private MetaMapper metaMapper;

    @Override
    public Integer add(DFLT_GTLS gtls, META meta) {
        String metaid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
        if(!gtls.getGates().isEmpty()){
            gtlsMapper.add(gtls, metaid);
        }else{
            gtlsMapper.addEmy(gtls, metaid);
        }
        metaMapper.add(meta,metaid);
        return null;
    }
}
